﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace MetricTime
{
    public class MetricDateTime : IComparable, IFormattable, 
	IConvertible, ISerializable
    {
        private const Int32 STANDARD_SECONDS = 86400;

        private Int32 _BaseSeconds = 0;

        public DateTime AngloBabylonianTime { get; set; }

        public MetricDateTime Now
        {
            get { throw new NotImplementedException(); }
        }

        /// <summary>
        /// 1/10 day (Metric hour)
        /// </summary>
        public Double deciday
        {
            get { return _BaseSeconds / (86400 / 10); }
            //set { this.centiday = value * 10; }
        }

        /// <summary>
        /// 1/100 day
        /// </summary>
        public Double centiday 
        {
            get { return _BaseSeconds / (86400 / 100); }
        }

        /// <summary>
        /// 1/1000 day (Metric minute)
        /// </summary>
        public Double milliday { get; set; }
        public Double microday { get; set; }

        public Double day { get; set; }

        public MetricDateTime(Int64 Ticks)
        {
            DateTime AngloBabylonianTime = new DateTime(Ticks);            
        }

        /// <summary>
        /// Metric date time constructor with analog date times.
        /// </summary>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <param name="day"></param>
        public MetricDateTime(Int32 year, Int32 month, Int32 day)
        {
            this.AngloBabylonianTime = new DateTime(year, month, day);
        }

        public MetricDateTime(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second)
        {
            this.AngloBabylonianTime = new DateTime(year, month, day, hour, minute, second);
            _BaseSeconds = (this.AngloBabylonianTime.Hour * 3600 + this.AngloBabylonianTime.Minute * 60 + this.AngloBabylonianTime.Second);
        }

        public MetricDateTime(DateTime AngloBabylonianTime)
        {
            this.AngloBabylonianTime = AngloBabylonianTime;
            _BaseSeconds = (this.AngloBabylonianTime.Hour * 3600 + this.AngloBabylonianTime.Minute * 60 + this.AngloBabylonianTime.Second);
        }

        public override string ToString()
        {
            return string.Format("{0:##.000}", this.centiday) + " UMT";
        }

        public string ToLongDateFormat()
        {
            return string.Format("{0}-{1}-{2}.###", "2001", "01", "01", this.centiday) + " UMT";
        }

        public MetricDateTime AddDays(Double Days)
        {
            throw new NotImplementedException();
        }

        #region IComparable Members

        public int CompareTo(object obj)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IFormattable Members

        public string ToString(string format, IFormatProvider formatProvider)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IConvertible Members

        public TypeCode GetTypeCode()
        {
            throw new NotImplementedException();
        }

        public bool ToBoolean(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public byte ToByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public char ToChar(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public DateTime ToDateTime(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public decimal ToDecimal(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public double ToDouble(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public short ToInt16(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public int ToInt32(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public long ToInt64(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public sbyte ToSByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public float ToSingle(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public string ToString(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public object ToType(Type conversionType, IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public ushort ToUInt16(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public uint ToUInt32(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public ulong ToUInt64(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISerializable Members

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
